<?
require_once("cms/core/helper/bean/Abstract.php");
require_once("cms/event/om/EventPeer.php");
require_once("cms/event/om/EventI18nPeer.php");

class PHP_CMS_View_Helper_Events extends AbstractList {

    public function events($form=null) {

        if($this->isInit)
            return $this;

        parent::init($form);

        if(strlen($form->getLanguage()) > 0)
            $this->criteria->add(EventI18nPeer::LANGUAGE_CODE,
                $form->getLanguage());


        if(strlen($form->getQuery()) == 0 && strlen($form->getLanguage()) == 0)
            $this->criteria->add(
                EventI18nPeer::LANGUAGE_CODE,
                $this->param(_Core::DEFAULT_LANGUAGE)
            );

        return $this;

    }


    /**
     * Define the propel method we are going to use to list
     * page items.
     */
    public function getMethod() {
        return "doSelectJoinEvent";
    }


    /**
     * Define the propel peer we are going to use to list
     * page items.
     */
    public static function getPeer() {
        return new EventI18nPeer();
    }


    /**
     * Return the searchable fields for this list page.
     */
    public static function getFields() {
        return array(
            EventPeer::DATE,
            EventPeer::URL,
            EventI18nPeer::NAME,
            EventI18nPeer::INTRO,
            EventI18nPeer::DESCRIPTION,
            EventI18nPeer::INSERT_DATE,
            EventI18nPeer::MODIFIED_DATE
        );
    }
}
?>